<?php
/*
 * 新锐手机注册 [ 深圳市新锐创意科技有限公司旗下产品 ]
 * Copyright  2015-2099 www.xinruiweb.com  All Rights Reserved.
 * 技术开发: 75674952@qq.com
 * 请支持正版授权产品
 */
if(!defined('IN_DISCUZ')) {
	exit('Access Denied');
}

require_once DISCUZ_ROOT.'./source/plugin/xinrui_mobilereg/config.php';


$setting = unserialize($_G['setting'][$plugin['identifier']]);

if(!submitcheck('settingsubmit')) {
    showformheader('plugins&operation=config&do='.$pluginid.'&identifier='.$plugin['identifier'].'&pmod=admincp_setting', 'enctype');

        showtableheader($_G['XRLANG_MOBLIEREG']['admincp_setting_top_1']);
            showsetting($_G['XRLANG_MOBLIEREG']['AppKey'], 'setting[AppKey]', $setting['AppKey'], 'text', '', 0);
            showsetting($_G['XRLANG_MOBLIEREG']['AppSecret'], 'setting[AppSecret]', $setting['AppSecret'], 'text', '', 0);
            showsetting($_G['XRLANG_MOBLIEREG']['sign'], 'setting[sign]', $setting['sign'], 'text', '', 0, $_G['XRLANG_MOBLIEREG']['sign_title']);
            showsetting($_G['XRLANG_MOBLIEREG']['tmp_id'], 'setting[tmp_id]', $setting['tmp_id'], 'text', '', 0,$_G['XRLANG_MOBLIEREG']['tmp_id_comment']);
            showsetting($_G['XRLANG_MOBLIEREG']['tmp_id1'], 'setting[tmp_id1]', $setting['tmp_id1'], 'text', '', 0,$_G['XRLANG_MOBLIEREG']['tmp_id_comment']);

            showsetting($_G['XRLANG_MOBLIEREG']['code_length'], 'setting[code_length]',  isset($setting['code_length'])&&!empty($setting['code_length'])?$setting['code_length']:6, 'text', '', 0,$_G['XRLANG_MOBLIEREG']['code_length_info']);
            showsetting($_G['XRLANG_MOBLIEREG']['code_time'], 'setting[code_time]', isset($setting['code_time'])&&!empty($setting['code_time'])?$setting['code_time']:600, 'text', '', 0,$_G['XRLANG_MOBLIEREG']['code_time_info']);
            showsetting($_G['XRLANG_MOBLIEREG']['code_time1'], 'setting[code_time1]', isset($setting['code_time1'])&&!empty($setting['code_time1'])?$setting['code_time1']:60, 'text', '', 0,$_G['XRLANG_MOBLIEREG']['code_time1_info']);

            showsetting($_G['XRLANG_MOBLIEREG']['reg_area'], 'setting[reg_area]', isset($setting['reg_area'])&&!empty($setting['reg_area'])?$setting['reg_area']:'', 'text', '', 0,$_G['XRLANG_MOBLIEREG']['reg_area_info']);

        showtableheader($_G['XRLANG_MOBLIEREG']['reg_setting_title']);
            showsetting($_G['XRLANG_MOBLIEREG']['reg_mobile_priority'], 'setting[reg_mobile_priority]', isset($setting['reg_mobile_priority'])&&!empty($setting['reg_mobile_priority'])?$setting['reg_mobile_priority']:1, 'radio', 0, 0, '');
            showsetting($_G['XRLANG_MOBLIEREG']['login_mobile_priority'], 'setting[login_mobile_priority]', isset($setting['login_mobile_priority'])&&!empty($setting['login_mobile_priority'])?$setting['login_mobile_priority']:1, 'radio', 0, 0, '');

            showsetting($_G['XRLANG_MOBLIEREG']['login_mobilereg'], 'setting[login_mobilereg]', isset($setting['login_mobilereg'])&&!empty($setting['login_mobilereg'])?$setting['login_mobilereg']:0, 'radio', 0, 0, $_G['XRLANG_MOBLIEREG']['login_mobilereg_info']);

            showsetting($_G['XRLANG_MOBLIEREG']['login_mobilelogin'], 'setting[login_mobilelogin]', isset($setting['login_mobilelogin'])&&!empty($setting['login_mobilelogin'])?$setting['login_mobilelogin']:0, 'radio', 0, 0, $_G['XRLANG_MOBLIEREG']['login_mobilelogin_info']);

            showsetting($_G['XRLANG_MOBLIEREG']['login_mobileupt'], 'setting[login_mobileupt]', isset($setting['login_mobileupt'])&&!empty($setting['login_mobileupt'])?$setting['login_mobileupt']:0, 'radio', 0, 0, $_G['XRLANG_MOBLIEREG']['login_mobileupt_info']);

            showsetting($_G['XRLANG_MOBLIEREG']['login_mobile1'], 'setting[login_mobile1]', isset($setting['login_mobile1'])&&!empty($setting['login_mobile1'])?$setting['login_mobile1']:0, 'radio', 0, 0, $_G['XRLANG_MOBLIEREG']['login_mobile1_info']);

            showsetting($_G['XRLANG_MOBLIEREG']['aliyun'], array('setting[aliyun]', array(
		array(0, $_G['XRLANG_MOBLIEREG']['aliyun_0']),
		array(1, $_G['XRLANG_MOBLIEREG']['aliyun_1']),
	)), isset($setting['aliyun'])&&!empty($setting['aliyun'])?$setting['aliyun']:0, 'mradio', 0, 0, $_G['XRLANG_MOBLIEREG']['aliyun_info']);


        showtablefooter();

        showsubmit('settingsubmit');
    showformfooter();
}else{
    $settings[$plugin['identifier']]['AppKey'] = trim($_REQUEST['setting']['AppKey']);
    $settings[$plugin['identifier']]['AppSecret'] = trim($_REQUEST['setting']['AppSecret']);
    $settings[$plugin['identifier']]['tmp_id'] = trim($_REQUEST['setting']['tmp_id']);
    $settings[$plugin['identifier']]['tmp_id1'] = trim($_REQUEST['setting']['tmp_id1']);
    $settings[$plugin['identifier']]['sign'] = trim($_REQUEST['setting']['sign']);

    $settings[$plugin['identifier']]['code_length'] = trim($_REQUEST['setting']['code_length']);
    $settings[$plugin['identifier']]['code_time'] = trim($_REQUEST['setting']['code_time']);
    $settings[$plugin['identifier']]['code_time1'] = trim($_REQUEST['setting']['code_time1']);
    $settings[$plugin['identifier']]['reg_area'] = trim($_REQUEST['setting']['reg_area']);

    $settings[$plugin['identifier']]['url'] = $_G['siteurl'];
    $settings[$plugin['identifier']]['reg_mobile_priority'] = intval($_REQUEST['setting']['reg_mobile_priority']);
    $settings[$plugin['identifier']]['login_mobile_priority'] = intval($_REQUEST['setting']['login_mobile_priority']);
    $settings[$plugin['identifier']]['login_mobilereg'] = intval($_REQUEST['setting']['login_mobilereg']);
    $settings[$plugin['identifier']]['login_mobilelogin'] = intval($_REQUEST['setting']['login_mobilelogin']);
    $settings[$plugin['identifier']]['login_mobileupt'] = intval($_REQUEST['setting']['login_mobileupt']);
    $settings[$plugin['identifier']]['login_mobile1'] = intval($_REQUEST['setting']['login_mobile1']);
    $settings[$plugin['identifier']]['aliyun'] = intval($_REQUEST['setting']['aliyun']);

	C::t('common_setting')->update_batch($settings);
	updatecache('setting');
	cpmsg('setting_update_succeed', 'action=plugins&operation=config&do='.$pluginid.'&identifier='.$plugin['identifier'].'&pmod=admincp_setting', 'succeed');
}
?>
